import request from '@/utils/request'

/** *
 * 获取组织架构数据
 * **/
export const getDepartmentsListApi = () => {
  return request({
    url: '/company/department'
  })
}

/**
 * 根据id删除部门
 * @param {*} id 部门id
 * @returns
 * **/
export const delDepartmentsApi = (id) => {
  return request({
    url: `/company/department/${id}`,
    method: 'delete'
  })
}

/**
 * 获取员工的简单列表
 * @returns
 * **/
export const getUserSimpleListApi = () => {
  return request({
    url: '/sys/user/simple'
  })
}

/**
 * 新增部门接口
 *  @param {*} form 部门id
 * @returns
 **/
export const addDepartmentApi = form => {
  return request({
    url: '/company/department',
    method: 'post',
    data: form
  })
}

/** *
 * 获取部门详情
 *  @param {*} id 部门id
 * @returns
 * ***/
export const getDepartmentDetailApi = (id) => {
  return request({
    url: `/company/department/${id}`
  })
}

/**
 * 编辑部门
 *  @param {*} data 修改部门参数
 * @returns
 ***/
export const editDepartmentApi = (data) => {
  return request({
    url: `/company/department/${data.id}`,
    method: 'put',
    data
  })
}
